<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    {{num}}
    <button v-on:click="num++">num增加</button>
    <button @dblclick="num++">num增加2</button>
    <button @mouseover="addNum">num增加3</button>
    <button @click="addNumFn(5, 8, 10, $event)">num增加4</button>
    <button @click="addNumFn2">num增加5</button>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        num: 10
      },
      methods: {
        addNum: function() {
          // console.log(111)
          // vm.num++

          this.num++
        },
        // 1. 带括号的函数调用 可以传递参数
        // 2. 事件对象  a. 带括号,需要人为传递 $event b.不带括号的函数调用，不需要人为传递任何东西，默认传递了
        addNumFn: function(n, m, j, e) {
          console.log(e.target.innerText)
          this.num = this.num + n + m + j
          // this.num += n + m + j
        },
        addNumFn2: function(e) {
          console.log(e.target)
        }
      }
    })
  </script>
</body>
</html>